package com.woniu.service;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.woniu.commons.exception.YogaException;
import com.woniu.model.dto.GoodsOrderDto;
import com.woniu.model.model.YGoodsOrder;
import com.woniu.model.param.OrderByShoppingCarParam;
import com.woniu.model.param.OrderPayParam;
import com.woniu.model.param.PageParam;

import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author 胡歌
 * @since 2024年05月28日
 */
public interface YGoodsOrderService extends IService<YGoodsOrder> {

    /**
     * 商城订单下单接口
     * @param param: //收货地址  addressName;
     *     //收货人 name;
     *     //收货人电话  phoneNum;
     *     //商品集合 goodsIdList;
     *     下单人的用户id userId;
     * @return 订单的dto
     * @throws YogaException
     */
    public GoodsOrderDto orderByShoppingCar(OrderByShoppingCarParam param)throws Exception;

    /**
     * 传一个对象，根据id去修改里面的信息
     * 在商城订单消费者里面用了，用于去修改商品的冻结量和数量
     * @param yGoodsOrder 商品对象
     * @return
     * @throws YogaException
     */
    public void updateByIdGoodsOrder(YGoodsOrder yGoodsOrder)throws YogaException;


    /**
     * 通过一个订单编号查询一个订单回去
     * @param orderNum：订单编号
     * @return 一个订单
     */
    public YGoodsOrder getOneId(String orderNum)throws YogaException;

    /**
     *发起支付
     * @param
     * @return
     * @throws Exception
     */
    public Object pay(OrderPayParam param) throws Exception;

    /**
     * 给支付宝回调的接口
     * @param
     * @return
     * @throws Exception
     */
    public void payNotify(Map<String, String> params)throws Exception;

    /**
     * 用户查询我的订单
     * @param param :pageNum; pageSize;
     * @param userId 用户id
     * @return page
     * @throws YogaException
     */
    public Page<YGoodsOrder> selsectOrders(PageParam param, int userId)throws YogaException;


    /**
     * 分页查询
     * @param param pageNum; pageSize;
     * @return
     * @throws YogaException
     */
    public Page<YGoodsOrder> loadPageGoodsOrder(PageParam param)throws YogaException;
}
